<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <%@ include file="/WEB-INF/page/base/css_common.jsp" %>

    <title>活动管理</title>
</head>

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 活动管理 <span
        class="c-gray en">&gt;</span> 活动列表 <a class="btn btn-success radius r mr-20"
                                              style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
    <shiro:hasPermission name="sys:user:add"> </shiro:hasPermission>
    <div class="cl pd-5 bg-1 bk-gray">
        <a href="javascript:;" onclick="delItems('${ctx}/activity/deletes')" class="btn btn-danger radius"><i
                class="Hui-iconfont">
            &#xe6e2;</i> 批量删除</a>
        <span class="l">
            <a class="btn btn-primary radius" href="javascript:;"
               onclick="add_activity('添加活动','${ctx}/activity/toAddActivity','1000','500')"><i class="Hui-iconfont">
                &#xe600;</i> 添加活动</a>
            <%--<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">--%>
                <%--&#xe6e2;</i> 批量删除</a>--%>
        </span>
    </div>

    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="6">活动管理</th>
        </tr>
        <tr class="text-c">
            <th style="width:18px;padding-right:6px;"><input id='checkall' type='checkbox'
                                                             value='true'/></th>
            <th width="40">ID</th>
            <th width="100">活动标题</th>
            <th width="200">活动图片</th>
            <th width="70">活动内容</th>
            <th width="70">开始时间</th>
            <th width="70">结束时间</th>
            <th width="70">酒店</th>
            <th width="70">会议厅</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${data }" var="d">
            <tr class="text-c">
                <td><input name='ids' type='checkbox' value=${d.id}></td>
                <td>${d.id}</td>
                <td>${d.title }</td>
                <td><img width="100" class="picture-thumb" src="${d.activitysImg}"></td>
                <td>${d.content }</td>
                <td>${d.beginTime}</td>
                <td>${d.endTime}</td>
                <td>${d.hotelName}</td>
                <td>${d.hallName}</td>
                <td class="f-14">
                    <a href="javascript:;" style="color:#2f63ba"
                       onclick="update_activity('活动修改','${ctx}/activity/toUpdate/${d.id}','1000','500')">修改</a>
                    <a href="${d.poster}" style="color:#2f63ba"  download="${d.poster}" target="_blank">海报下载</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<%@ include file="/WEB-INF/page/base/common.jsp" %>
<script type="text/javascript">
    /*添加用户*/
    function add_activity(title, url) {
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }
    function update_activity(title, url) {
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }

    $(function () {
        $('#checkall').click(function () {
            var items = document.getElementsByName('ids');
            for (var i = 0; i < items.length; i++) {
                items[i].checked = this.checked;
            }
        });
    })


    function activity_stop(id) {
        $.ajax({
            url: "${ctx}/activity/disable/" + id,
            type: 'post',
            data: null,
            success: function (data) {
                window.location.reload();
            }
        })
    }
    function activity_start(id) {
        $.ajax({
            url: "${ctx}/activity/enable/" + id,
            type: 'post',
            data: null,
            success: function (data) {
                window.location.reload();
            }
        })
    }

</script>
</body>
</html>
